﻿using System;

class SumOfSubset

            // We are given 5 integer numbers. Write a program that checks if the sum of some subset of them is 0. Example: 3, -2, 1, 1, 8 -- 1+1-2=0.

{
    static void Main()
    {
        Console.WriteLine("Enter five numbers");
        int a = int.Parse(Console.ReadLine());
        int b = int.Parse(Console.ReadLine());
        int c = int.Parse(Console.ReadLine());
        int d = int.Parse(Console.ReadLine());
        int e = int.Parse(Console.ReadLine());
        int sum;
        int subCount = 0;
        for (int i = 1; i <= 31; i++)
        {
            sum = 0;
            if ((i & 1) == 1)
            {
                sum += a;
            }
            if (((i >> 1) & 1) == 1)
            {
                sum += d;
            }
            if (((i >> 2) & 1) == 1)
            {
                sum += c;
            }
            if (((i >> 3) & 1) == 1)
            {
                sum += b;
            }
            if (((i >> 4) & 1) == 1)
            {
                sum += a;
            }
            if (sum == 0)
            {
                subCount++;
            }
        }
        Console.WriteLine("Total subsets equal to 0: {0}", subCount);
    }
}

